package com.ruoyi.system.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.system.domain.OperLog;
import com.ruoyi.system.mapper.OperLogMapper;
import com.ruoyi.system.service.IGiveLogService;
import com.ruoyi.system.service.IOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.support.Convert;

/**
 * 用户 服务层实现
 * 
 * @author ruoyi
 * @date 2019-01-06
 */
@Service
public class OperLogServiceImpl implements IOperLogService
{
	@Autowired
	private OperLogMapper operLogMapper;
	@Autowired
	private IGiveLogService giveLogService;

	/**
     * 查询用户信息
     * 
     * @param id 用户ID
     * @return 用户信息
     */
    @Override
	public OperLog selectOperLogById(Integer id)
	{
	    return operLogMapper.selectOperLogById(id);
	}
	
	/**
     * 查询用户列表
     * 
     * @param operLog 用户信息
     * @return 用户集合
     */
	@Override
	public List<OperLog> selectOperLogList(OperLog operLog)
	{
	    return operLogMapper.selectOperLogList(operLog);
	}
	
    /**
     * 新增用户
     * 
     * @param operLog 用户信息
     * @return 结果
     */
	@Override
	public int insertOperLog(OperLog operLog)
	{
	    return operLogMapper.insertOperLog(operLog);
	}
	
	/**
     * 修改用户
     * 
     * @param operLog 用户信息
     * @return 结果
     */
	@Override
	public int updateOperLog(OperLog operLog)
	{
	    return operLogMapper.updateOperLog(operLog);
	}

	/**
     * 删除用户对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteOperLogByIds(String ids)
	{
		return operLogMapper.deleteOperLogByIds(Convert.toStrArray(ids));
	}

	@Override
	public List<Map<String, Object>> qryBiOperLog(Map<String, Object> map,Integer type) {
		if (type == 3){
			return giveLogService.qryGiveLogByCreateBy(map);
		}else {
			return operLogMapper.qryBiOperLog(map);
		}

	}

}
